service_name=php
unit_file=./sapi/fpm/php-fpm.service
[[ $sysinit_versioned == true ]] && \
    service_name=$(echo $php_mayor_revision|sed -r 's/[-\.x]//g')

if [ -d /usr/lib/systemd/system ]; then
	systemd_unit=/usr/lib/systemd/system
elif [ -d /lib/systemd/system ]; then
	systemd_unit=/lib/systemd/system
else
	echo Unable to locate systemd dir!
	exit;
fi
systemd_unit=${systemd_unit}/${service_name}-fpm.service
$userdo cp -v $unit_file $systemd_unit
#
# Replace PID file to allow several PHP versions
[[ $sysinit_versioned == true ]] && \
	sed -r -i "s/PIDFile=\/var\/run\/php-fpm.pid/PIDFile=\/var\/run\/${service_name}-fpm.pid/" $systemd_unit
#
# Enable and start the unit
$userdo systemctl enable ${service_name}-fpm && \
$userdo systemctl start ${service_name}-fpm && \
$userdo systemctl status ${service_name}-fpm
